#! /usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import absolute_import

from celery import Celery, platforms
from celery.schedules import crontab

platforms.C_FORCE_ROOT = True

broker_url = "amqp://guest:guest@localhost:5672//"
backend_url = "amqp://guest:guest@localhost:5672//"

app = Celery('myTest',
             broker=broker_url,
             backend=backend_url,
             include=['myTest.tasks'])

app.conf.update(
    CELERY_TASK_SERIALIZER = 'json',
    CELERY_RESULT_SERIALIZER = 'json',
    CELERY_TIMEZONE= 'Asia/Shanghai',
    CELERY_TASK_RESULT_EXPIRES=3600,
    CELERYBEAT_SCHEDULE = {
        'every-hour': {
            'task': 'web.check',
            'schedule': crontab(minute='*/5', hour='*'),
        },
    }
)

if __name__ == "__main__":
    app.start()
